package fr.ralmn.OgameDroid.Object;

import fr.ralmn.OgameDroid.R;
import fr.ralmn.OgameDroid.Object.Dependence.Require;

/**
 * @author ralmn
 */

public class Batiment {

	/**
	 * 
	 * @author ralmn Type de batiments
	 */
	public static enum BatimentsType {
		Ressources, Batiments
	}

	protected BatimentsType type;
	protected Require require;
	protected double baseMetal;
	protected double baseCristal;
	protected double baseDeterium;
	protected double baseEnergie;
	protected String name;
	protected String desc;
	protected int img = R.drawable.error100;

	public Batiment(String n, String d, int i) {
		name = n;
		desc = d;
		img = i;
		require = new Require();
	}

	public Batiment(String n, String d, int bm, int bc, int bd) {
		img = R.drawable.error100;
		name = n;
		desc = d;
		baseMetal = bm;
		baseCristal = bc;
		baseDeterium = bd;
	}

	public int getImg() {
		
		if(img == 0){
			return R.drawable.error100;
		}
		
		return img;
	}

	public Batiment setImg(int img) {
		this.img = img;
		return this;
	}

	public String getName() {
		return name;
	}

	public String getDesc() {
		return desc;
	}

	/**
	 * 
	 * @deprecated Retirer car inutile
	 */
	public int getMax_lvl() {
		return 0;
	}

	public int getCoastMetal(int lvl) {

		int r = 0;

		for (int i = 0; i < lvl; i++) {
			r += baseMetal;
		}

		return r;
	}

	public int getCoastCristal(int lvl) {
		int r = 0;

		for (int i = 0; i < lvl; i++) {
			r += baseCristal;
		}
		return r;
	}

	public int getCoastDeterium(int lvl) {
		int r = 0;

		for (int i = 0; i < lvl; i++) {
			r += baseDeterium;
		}
		return r;
	}

	public int getCoastEnergie(int lvl) {
		return 0;
	}

	public int getIcon() {
		return img;
	}

	public Require getRequire() {
		
		return require;
	}

}
